Objectives

In this project, we try to visualize the echirp - the exponential chirp signal.

In addition, for plotting, we will use the ggplot2 and plotly libraries.

Exponential Chirp

The utility echirp can generate an exponential chirp signal of a specified frequencies.

usage: echirp outputfilename [amplitude=1.0 [startfreq=220 endfreq=440]]

Setup the environment

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

Basic exponential chirp signal - time domain

Generate a simple echirp signal .

../../echirp/bin/echirp echirp.csv

Time domain plot

echirp<-read.csv("echirp.csv")
names(echirp)<-c("t","y")
ggplot(echirp,aes(x=t,y=y))+geom_line()

Frequency Domain

fechirp <- data.frame( f = seq( 0, nrow(echirp) - 1 ) / ( nrow(echirp) * diff( echirp$t[ 1:2 ] ) ) )
fechirp$mag <- Mod( fft( echirp$y ) )
p<-ggplot(slice_head(fechirp,n=nrow(echirp)/2),aes(x=f,y=mag))+geom_line()
ggplotly(p)